<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition template="/template/template.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<body>
	
	<!--modal para cadastro do segmento -->
	
		<ui:define name="content">
		
			<h:form id="formSegmento">
			
			 <p:growl id="messages" showDetail="true"/>  
			 
				<p:panel header="Segmento: " style="width:1307px"><br></br>
					
					<h:panelGrid columns="4" style="margin-left:350px;">
						<h:outputLabel value="#{msg.label_nome}"></h:outputLabel><strong>*</strong>  
						<p:inputText id="nomeSegmento" value="#{segmentoMB.segmento.nome}" size="50" ></p:inputText>
						
						<p:commandButton id="cadastro" ajax="false" action="#{segmentoMB.inserirSegmento}" value="#{msg.label_Cadastrar}" update="tabelaSegmento">
							<f:actionListener type="casamento.util.ValidaSegmento"></f:actionListener>
						</p:commandButton>
					</h:panelGrid><br></br><br></br>
					
				<p:dataTable id="tabelaSegmento" value="#{segmentoMB.listaSegmento}" var="seg"  style="width:50%; margin-left:350px;"
					editable="true" editMode="cell" paginator="true" rows="10" emptyMessage="Nenhum registro encontrado!" >  
		  			
		  			<p:ajax event="cellEdit" listener="#{segmentoMB.alterarSegmento}" update=":formSegmento:messages"/>  
		  			<h:inputHidden id="hiddenId" value="#{seg.id}" />
		  			
		  			<p:column headerText="Nome:" id="nome" styleClass="text_table" style="width:24%"> 
			  			 <p:cellEditor>  
					    	<f:facet name="output"><h:outputText styleClass="text_table" value="#{seg.nome}"/> 	</f:facet>
							<f:facet name="input"><h:inputText styleClass="text_table" size="15" value="#{seg.nome}"/></f:facet>		        
				         </p:cellEditor>   
		        	</p:column> 
		        			        			        			        	
				</p:dataTable>	
				 <p style="margin-top: 30px;"><strong>(*) </strong> Campos Obrigatórios.</p>
				</p:panel>
				
			</h:form>

</ui:define>

</body>
</ui:composition>
